package com.joker.yuwu;

import com.joker.repository.SearchZg;
import com.mysql.cj.xdevapi.JsonArray;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/searchzg")

public class SearchZgxinxi extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/json; charset=utf-8");
//        String username=req.getParameter("username");
        SearchZg s1=new SearchZg();
        JSONObject obj=new JSONObject();
//        JSONArray array=new JSONArray();
        obj.put("data",s1.show());

//        System.out.println(s1.show());

        resp.getWriter().write(obj.toString());

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        super.doPost(req, resp);
    }
}
